﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace View
{
    public partial class cashUpload : Form
    {
        public cashUpload()
        {
            InitializeComponent();
        }

        private void bCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void bUpload_Click(object sender, EventArgs e)
        {
            ///
            ///Upload control
            ///

            try
            {
                for (int i = 0; i < tbUpload.Text.Length; i++)
                {
                    if (!((tbUpload.Text[i] >= '0') && (tbUpload.Text[i] <= '9')))
                    {
                        throw new ArgumentException();
                    }
                }
                Model m1 = new Model(Convert.ToDouble(tbUpload.Text));
                m1.Upload();
                MessageBox.Show("Upload (" + tbUpload.Text + " USD) ");
                tbUpload.Text = "0";
            }
            catch (ArgumentException)
            {
                MessageBox.Show("Invalid character");
            }
            catch
            {
                MessageBox.Show("Hiba");
            }
        }
    }
}
